/**
 * 获取 Flash 当前的信息
 * @author	czbin
 * 2009-1-8 11:42
 **/
package com.ibio8.system {
	import flash.system.Capabilities;
	/**
	 * 获取 Flash 当前的信息。
	 * 
	 * <p>
	 * 获取 Flash 当前的信息，例如所在的平台、版本等。
	 * </p>
	 * @example 返回的内容如下：WIN 9,0(a),15,0(b)
	 * <b>此类原作者 czbin。</b>
	 */
	public class FlashPlayer{
		protected static var m_versionString:String = Capabilities.version;
		protected static var m_pattern:RegExp = /^(\w*) (\d*),(\d*),(\d*),(\d*)$/;
		protected static var m_result:Object = m_pattern.exec(m_versionString);
		
		/**
		 * 当前所在的平台
		 * this as the Example's "WIN"
		 */
		public static function get platform():String{
			if (m_result != null) {
				return m_result[1];
			}else {
				return null;
			}
		}
		
		/**
		 * 主要版本
		 * this as the Example's "9"
		 */
		public static function get majorVersion():int{
			if (m_result != null) {
				return m_result[2];
			}else {
				return -1;
			}
		}
		
		/**
		 * 副版本
		 * this as the Example's "0(a)"
		 */
		public static function get minorVersion():int{
			if (m_result != null) {
				return m_result[3];
			}else {
				return -1;
			}
		}
		
		/**
		 * 编译号
		 * this as the Example's "15"
		 */
		public static function get buildNumber():int{
			if (m_result != null) {
				return m_result[4];
			}else {
				return -1;
			}
		}
		
		/**
		 * 内部编译号
		 * this as the Example's "0(b)"
		 */
		public static function get internalBuildNumber():int{
			if (m_result != null) {
				return m_result[5];
			}else {
				return -1;
			}
		}
	}
}